<template>
    <div>
        <el-row>
            <el-col :span="21">
                <el-input v-model="input"  placeholder="Please input" @keydown.enter="add()" />
            </el-col>
            <el-col :span="3">
                <el-button type="primary" @click="add()" >添加任务</el-button>
            </el-col>
        </el-row>
    </div>
</template>
<script>
import {ElMessageBox,} from 'element-plus'
export default {
  data() {
    return {
      input: ''
    }
  },
  methods:{
    add(i){
      if(this.input==''){
        ElMessageBox.confirm(
              '你是不是那个啥比?',
              '真的吗',
              {
                confirmButtonText: '确认',
                cancelButtonText: '先算了',
                type: 'warning',
              })
        .then(() => {
          this.$emit('input',i)
        })
        .catch(() => {
        
        })}else{
        this.$emit("add",this.input)
          this.input=''
        }
    },
  }
}
</script>